package com.example.myFirstProject.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.myFirstProject.entity.Dept;
import com.example.myFirstProject.mapper.DeptMapper;
import com.example.myFirstProject.service.DeptService;

@Service
@Transactional
public class DeptServiceImpl implements DeptService{

	@Autowired
	private DeptMapper deptMapper;
	
	private List<Dept> list;
	
	@Override
	public int insertDept(Dept dept) {
		// TODO Auto-generated method stub
		return deptMapper.insertDept(dept);
	}

	@Override
	public int deleteDept(Integer deptId) {
		// TODO Auto-generated method stub
		return deptMapper.deleteDept(deptId);
	}

	@Override
	public int updateDept(Dept dept) {
		// TODO Auto-generated method stub
		return deptMapper.updateDept(dept);
	}

	@Override
	public List<Dept> selectDept() {

		list = new ArrayList<Dept>();
		list = deptMapper.selectDept();
		return list;
	}

	@Override
	public Dept selectOneDept(Integer deptId) {
		Dept dept = new Dept();
		dept = deptMapper.selectOneDept(deptId);
		return dept;
	}

}
